package com.zjitc.exception;

import org.springframework.web.bind.annotation.ControllerAdvice;
import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.servlet.HttpServletBean;
import org.springframework.web.servlet.ModelAndView;

import javax.servlet.http.HttpServletRequest;

@ControllerAdvice
public class GalbolExceptionHandler {
    @ExceptionHandler(value = Exception.class)
    public ModelAndView GalbolExceptionHandler(HttpServletRequest req, Exception e){
        ModelAndView mav = new ModelAndView();
        mav.addObject("url",req.getRequestURL());
        mav.addObject("exception",e.getMessage());
        mav.setViewName("error");
        return mav;
    }
}
